$(document).ready(function () {
	$(".editorcontent").each(function(i){
		if($(".editorcontent").text()==''){
			$(".editorcontent").hide();
		}
	});
	MenuType();
	$("#searchkeyword").css("color","#999999");
	$(".t_a_feed").css("color","#999999");

	$("#nav .tag").each(function(i){
	$(this).mouseover(function(){
		$("#menu .conBox").hide().eq(i).show();
	});
	});

	$("#nav a").each(function(i){
		$(this).mouseover(function(){
			$("#nav a").removeClass().eq(i).addClass("select");
		});
	});


});

function getScroll(id){
	var pages=parseInt(id);
	var bottompage;
	$("#hot_header a").removeClass("a1");
	if(pages>4){
		var num=parseInt($("#scrollnums").html());
		if(num>=4){
			pages=1;
		}else{
			pages=num + 1;
		}
		$("#scroll_"+pages).addClass("a1");
	}else{
		if(pages>=4){
			if(pages==4){bottompage=4;}else{bottompage=pages;}
			pages=1;
			$("#scroll_"+bottompage).addClass("a1");
		}else{
			$("#scroll_"+pages).addClass("a1");
			pages=pages + 1;
		}
	}
	$("#scrollnums").html(pages);
	//加载中
	$("#hostlistarea").html('<div class="load_top"></div>')
	$.post("http://www.massteam.com/plus/scroll.htm", {id:pages},
	 function(data) {
	  $("#hostlistarea").html(data);
	 }
	);
}




function MenuType(){
	var typename=$("#myreid").html();
	$("#"+typename).addClass("select");
	$("#"+typename+"list").show();
}

function checkInput(){
	var vals=$("#searchkeyword").val();
	if(vals==''||vals=='请输入关键词...'){
		$("#searchkeyword").css("color","#C84242");
		return false;
	}
}

function clearMumayi(obj,vals){
	var oldval=$(obj).val();
	if(oldval==vals){
		$(obj).val('');
		$(obj).css("color","#999999");
	}
}

function showMumayi(obj,vals){
	var oldval=$(obj).val();
	if(oldval==''){
		$(obj).val(vals);
		$(obj).css("color","#999999");
	}
}

function getChanges(obj,vals){
	var oldval=$(obj).val();
	if(oldval!=''||this.value!=vals){
		$(obj).css("color","black");
	}
}

function AddFavorite(sURL,sTitle){
    try{
        window.external.addFavorite(sURL, sTitle);
    }catch (e){
        try{
            window.sidebar.addPanel(sTitle, sURL, "");
        }catch (e){
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}

function SetHomePage(obj,url){
	try{
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage(url);
	}catch(e){
		if(window.netscape) {
			try {
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
				var prefs =		Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
				prefs.setCharPref('browser.startup.homepage',url);
			} catch (e) {
				alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'");
			}
		}
	}
}

/*回顶部*/
(function(){
	var n=0;
	var obj=document.getElementById("TopLayout");
	if(!obj){return false;}
	var x=0;
	var fe=$("#TopLayout");
	window.onscroll=function(){
		
		obj.style.top=(document.body.scrollTop||document.documentElement.scrollTop)+n+'px';
		x=(document.body.scrollTop||document.documentElement.scrollTop)+n;
		if(x==0){fe.fadeOut().hide()}else{fe.fadeIn().show()};
	};
	window.onresize=function(){obj.style.top=(document.body.scrollTop||document.documentElement.scrollTop)+n+'px'};
})();